﻿Public Class frmAccountMenu

    Private Sub mnuAbout_Click(sender As Object, e As EventArgs) Handles mnuAbout.Click
        frmAbout.Show()
    End Sub

    Private Sub mnuExit_Click(sender As Object, e As EventArgs) Handles mnuExit.Click
        Application.Exit()
    End Sub

    Private Sub MainToolStripMenuItem_Click(sender As Object, e As EventArgs)
        frmMain.Show()
    End Sub

    Private Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click
        If My.Application.OpenForms.OfType(Of frmLogin)().Any() Then
            'Loads frmLogin
            frmLogin.Hide()
            frmLogin.Show()
        ElseIf My.Application.OpenForms.OfType(Of frmCreateAccount)().Any() Then
            'Loads frmLogin
            frmLogin.Show()
            frmCreateAccount.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmEditAccount)().Any() Then
            'Loads frmLogin
            frmLogin.Show()
            frmEditAccount.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmDeleteAccount)().Any() Then
            'Loads frmLogin
            frmLogin.Show()
            frmDeleteAccount.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmForgotPassword)().Any() Then
            'Loads frmLogin
            frmLogin.Show()
            frmForgotPassword.Close()
        End If
    End Sub

    Private Sub btnAddNewAccount_Click(sender As Object, e As EventArgs) Handles btnAddNewAccount.Click
        If My.Application.OpenForms.OfType(Of frmLogin)().Any() Then
            'Loads frmCreateAccount
            frmCreateAccount.Show()
            frmLogin.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmCreateAccount)().Any() Then
            'Loads frmCreateAccount
            frmCreateAccount.Hide()
            frmCreateAccount.Show()
        ElseIf My.Application.OpenForms.OfType(Of frmEditAccount)().Any() Then
            'Loads frmCreateAccount
            frmCreateAccount.Show()
            frmEditAccount.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmDeleteAccount)().Any() Then
            'Loads frmCreateAccount
            frmCreateAccount.Show()
            frmDeleteAccount.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmForgotPassword)().Any() Then
            'Loads frmCreateAccount
            frmCreateAccount.Show()
            frmForgotPassword.Close()
        End If
    End Sub

    Private Sub btnEditAccount_Click(sender As Object, e As EventArgs) Handles btnEditAccount.Click
        If My.Application.OpenForms.OfType(Of frmLogin)().Any() Then
            'Loads frmEditAccount
            frmEditAccount.Show()
            frmLogin.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmCreateAccount)().Any() Then
            'Loads frmEditAccount
            frmEditAccount.Show()
            frmCreateAccount.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmEditAccount)().Any() Then
            'Loads frmEditAccount
            frmEditAccount.Hide()
            frmEditAccount.Show()
        ElseIf My.Application.OpenForms.OfType(Of frmDeleteAccount)().Any() Then
            'Loads frmEditAccount
            frmEditAccount.Show()
            frmDeleteAccount.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmForgotPassword)().Any() Then
            'Loads frmEditAccount
            frmEditAccount.Show()
            frmForgotPassword.Close()
        End If
    End Sub

    Private Sub btnDeleteAccount_Click(sender As Object, e As EventArgs) Handles btnDeleteAccount.Click
        If My.Application.OpenForms.OfType(Of frmLogin)().Any() Then
            'Loads frmDeleteAccount
            frmDeleteAccount.Show()
            frmLogin.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmCreateAccount)().Any() Then
            'Loads frmDeleteAccount
            frmDeleteAccount.Show()
            frmCreateAccount.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmEditAccount)().Any() Then
            'Loads frmDeleteAccount
            frmDeleteAccount.Show()
            frmEditAccount.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmDeleteAccount)().Any() Then
            'Loads frmDeleteAccount
            frmDeleteAccount.Hide()
            frmDeleteAccount.Show()
        ElseIf My.Application.OpenForms.OfType(Of frmForgotPassword)().Any() Then
            'Loads frmDeleteAccount
            frmDeleteAccount.Show()
            frmForgotPassword.Close()
        End If
    End Sub

    Private Sub btnForgotPassword_Click(sender As Object, e As EventArgs) Handles btnForgotPassword.Click
        If My.Application.OpenForms.OfType(Of frmLogin)().Any() Then
            'Loads frmForgotPassword
            frmForgotPassword.Show()
            frmLogin.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmCreateAccount)().Any() Then
            'Loads frmForgotPassword
            frmForgotPassword.Show()
            frmCreateAccount.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmEditAccount)().Any() Then
            'Loads frmForgotPassword
            frmForgotPassword.Show()
            frmEditAccount.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmDeleteAccount)().Any() Then
            'Loads frmForgotPassword
            frmForgotPassword.Show()
            frmDeleteAccount.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmForgotPassword)().Any() Then
            'Loads frmForgotPassword
            frmForgotPassword.Hide()
            frmForgotPassword.Show()
        End If
    End Sub
End Class